document.addEventListener('DOMContentLoaded', () => {
    // 模拟从后端获取数据
    fetch('http://192.168.224.26:8082/chargeStation/screenShowYesData') // 替换为你的后端API地址
        .then(response => response.json())
        .then(data => {
            const container = document.getElementById('ele_data-container');
            data.data.forEach(item => {
                const ul = document.createElement('ul');

                const liName = document.createElement('li');
                liName.textContent = item.name; // 充电站名
                liName.classList.add('project-name-down');
                ul.appendChild(liName);

                const liOrderCount = document.createElement('li');
                liOrderCount.textContent = parseInt(item.orderNum); // 订单量 (去除小数)
                ul.appendChild(liOrderCount);

                const liTotalElectricity = document.createElement('li');
                liTotalElectricity.textContent = item.totalEle; // 总用电量kwh
                ul.appendChild(liTotalElectricity);

                const liOrderAmount = document.createElement('li');
                liOrderAmount.textContent = item.orderMoneySum; // 订单金额
                ul.appendChild(liOrderAmount);

                const liServiceFee = document.createElement('li');
                liServiceFee.textContent = item.serviceMoneySum; // 订单服务费
                ul.appendChild(liServiceFee);

                const liChargingTime = document.createElement('li');
                liChargingTime.textContent = item.eleTime; // 充电时长
                ul.appendChild(liChargingTime);

                container.appendChild(ul);
            });
        })
        .catch(error => console.error('Error fetching data:', error));
});